package cz.muni.fi.pa165.machineryrental.service;

import cz.muni.fi.pa165.machineryrental.dto.CustomerDTO;
import java.util.List;

/**
 * Customer service interface
 *
 * @author Martin Klvana, 395893
 */
public interface CustomerService {

    /**
     * Returns Customer with given id. Returns null if customer does not exists.
     *
     * @param id long of customer
     * @return CustomerDTO if Customer with given id exists, null otherwise.
     * @throws IllegalArgumentException Throws if given id is null.
     * @throws DataAccessException Throws if a data access exception occurred.
     */
    public CustomerDTO getById(long id);

    /**
     * Creates given customer in database.
     *
     * @param customer CustomerDTO to save
     * @throws IllegalArgumentException Throws if given customer is null.
     * @throws DataAccessException Throws if a data access exception occurred.
     */
    public void create(CustomerDTO customer);

    /**
     * Updates given customer in database.
     *
     * @param customer CustomerDTO to update
     * @throws IllegalArgumentException Throws if given customer is null.
     * @throws DataAccessException Throws if a data access exception occurred.
     */
    public void update(CustomerDTO customer);

    /**
     * Removes given customer from database.
     *
     * @param customer CustomerDTO to remove
     * @throws IllegalArgumentException Throws if given customer is null.
     * @throws DataAccessException Throws if a data access exception occurred.
     */
    public void remove(CustomerDTO customer);

    /**
     * Returns all customers in database.
     *
     * @return List of all customers.
     * @throws DataAccessException Throws if a data access exception occurred.
     */
    public List<CustomerDTO> findAll();

    /**
     * Returns customer with given lastName.
     *
     * @param lastName lastName.
     * @return customerDTO of cusomer with given lastName
     * @throws IllegalArgumentException Throws if given lastName is null.
     * @throws DataAccessException Throws if a data access exception occurred.
     */
    public List<CustomerDTO> findByLastName(String lastName);

    /**
     * Returns customer with given email.
     *
     * @param email email.
     * @return customerDTO of customer with given email
     * @throws IllegalArgumentException Throws if given email is null.
     * @throws DataAccessException Throws if a data access exception occurred.
     */
    public CustomerDTO findByEmail(String email);

    /**
     * Returns customer with given companyNumber.
     *
     * @param companyNumber companyNumber.
     * @return customerDTO of customer with given companyNumber
     * @throws IllegalArgumentException Throws if given companyNumber is null.
     * @throws DataAccessException Throws if a data access exception occurred.
     */
    public CustomerDTO findByCompanyNumber(String companyNumber);
}
